import { POST } from "@/api";
import { config } from "@/config";
import { VagueOject } from "@/types/common";
import { OrderType } from "@/types/res/order";

export const allOrder = async (data: VagueOject = {}, header: VagueOject = {}): Promise<OrderType[]> => {
    let res = await POST<OrderType[]>({
        url: config.apiList.allOrder,
        data,
        header
    })

    res.forEach(v => {
        v.wares_masterimg = JSON.parse(<string>v.wares_masterimg)
    })

    return res
}

export const buyOrder = async (data: VagueOject = {}, header: VagueOject = {}): Promise<void> => {
    return await POST<void>({
        url: config.apiList.buyOrder,
        data,
        header
    })
}


